﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TT.Module.sysLogin;
using System.Data;
using Bill.BasDLL.ety;
using SQLHelper;

namespace Exp.BillDLL.dao
{
        public class daoArea
        {
            etyBaeSystemParamter basSysParam;

            public daoArea(etyBaeSystemParamter ibasSysParam)
            {
                basSysParam = ibasSysParam;
            }

            public DataTable GetArea(etyArea inEty)
            {
                string sql = "select CLIENT_NAME,BUSS_DESC,SF_DESC,CLIENT_ID,BUSS_TYPE,SF,AREA_NAME from vw_bas_area "
                    + " where client_id=:client_id and buss_type=:buss_type ";

                //IList<etyArea> ilEty = new List<etyArea>();
                //ilEty.Add(inEty);
                return basSysParam.SqlHelp.ExecuteReader(sql, inEty);
            }

            public bool SaveArea(etyArea inEty)
            {
                string sql = "insert into bas_area(PORT_CODE,CLIENT_ID,AREA_NAME,BUSS_TYPE,SF)  "
                    + " values(:PORT_CODE,:CLIENT_ID,:AREA_NAME,:BUSS_TYPE,:SF)";

                return basSysParam.SqlHelp.ExecuteTrans(sql, inEty).Exec_Success;
            }

            public bool DeleteArea(etyArea inEty)
            {
                string sql = " delete bas_area where client_id=:client_id and area_name=:area_name and buss_type=:buss_type and sf=:sf ";

                return basSysParam.SqlHelp.ExecuteTrans(sql, inEty).Exec_Success;

            }
        }
}
